// Copyright 2009 StarCite Inc.  All rights reserved.
// ListServerFilesServlet.java 5:39:28 PM danny.liu
package com.billowsoft.file.sync;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author danny.liu Nov 15, 2011
 * @version 1.0
 * 
 */
public class ListServerFilesServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		File folder = new File("\\\\shfile01\\Backup\\danny.liu");
		File[] files = folder.listFiles();
		List<String> filesName = new ArrayList<String>();
		for(File file : files){
			filesName.add(file.getName());
		}
		req.setAttribute("fileNames", filesName);
		getServletContext().getRequestDispatcher("/showServerFiles.jsp").forward(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}

	
}
